/***************************************************************************
 创建者: 华磊
 开始时间: 2019.1.16
 copyright: (C) 华友高科
 修改说明:
 ***************************************************************************
 *  @file
 *  功能:
 *　模拟服务器
 *
 *                                                                         *
 ***************************************************************************/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTimer>
#include <QTcpServer>
#include <QTcpSocket>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private slots:
    void on_pushButton_sendJson_clicked();
    void timeOut_slot();

    void on_pushButton_startServer_clicked();
    void newConnectionSlot();

private:
    int receiveData();
    int sendSensorInfo();
    int process_manual_allSensorData(QJsonObject &redeiveJsonObjIn);

private:
    Ui::MainWindow *ui;
    QTimer *timer;
    QTcpServer *tcpServer;
    QTcpSocket *newSocket;
    int clientCount;
    int receiveCommandCount;
    int sendInfoCount;
};

#endif // MAINWINDOW_H
